package com.his.system.manager.task;

import java.util.Calendar;
import java.util.Date;

/**
 * 测试JDK Timer的执行
 *
 * @Description
 * @Author HHJ
 * @Date 2020-07-25 16:17
 */
public class TaskThreadTest {

    private static final int h_time = 10;
    private static final int m_time = 20;
    private static final int s_time = 0;


    //时间间隔(秒)
    private static final long periodSecond = 30;

    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        //凌晨0点
        calendar.set(Calendar.HOUR_OF_DAY, h_time);
        calendar.set(Calendar.MINUTE, m_time);
        calendar.set(Calendar.SECOND, s_time);
        //第一次执行定时任务的时间
        Date date = calendar.getTime();
        TaskThread timer = new TaskThread();
        timer.start(date, periodSecond);
    }
}
